﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
namespace Web.frontpage.SignUp
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["studentId"] != null && Session["studentName"] != null)
                Response.Redirect("SUIndex.aspx");
        }
        protected void SubmitClick(object sender ,EventArgs e)
        {
            BLL.StudentService students = new BLL.StudentService();
            //string verfication = txtVerfication.Value;
            //if (verfication.ToLower() != Session["CheckCode"].ToString().ToLower())
            //{
            //    Response.Write("<script>alert(\"验证码错误\")</script>");
            //}
            //else
            //{
                BoStudents model = new BoStudents();
                model.STU_USERNAME = username.Value;
                model.STU_PASSWORD = password.Value;
                BoStudents resultModel = students.CheckStudent(model);
                if (resultModel != null)
                {
                    Session["studentId"] = resultModel.STU_ID;
                    Session["studentName"] = resultModel.STU_NAME;
                    Response.Redirect("SUIndex.aspx");
                }
                else
                {
                    Response.Write("<script>alert(\"用户名或者密码错误\")</script>");
                }
            //}
        }
        
    }
}